package juc.volatileDemo;

/**
 * @author liuchaoqun
 * @date 2022/8/26
 * @Description
 */
public class VolatileResource implements Runnable {
    private volatile boolean tag = false;

    @Override
    public void run() {
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        this.tag = true;
        System.out.println(tag);

    }

    public boolean getTag(){
        return this.tag;
    }
}
